package patrol.mobile.com.mobilepatrol.manager;

import java.util.List;
import java.util.Map;

import patrol.mobile.com.mobilepatrol.bean.RouteSurveyTaskStructBO;

/**
 * Created by apple on 17/12/13.
 */

public class RoadSurveyManager {
//    public static void delAllRoadSurvey(){
//        realm.executeTransaction(new Realm.Transaction() {
//            @Override
//            public void execute(Realm realm) {
//                realm.delete(RouteSurveyTaskDataBO.class);
//            }
//        });
//    }
//    public static int getCount(){
//        return realm.where(RouteSurveyTaskDataBO.class).findAll().size();
//    }
//    public static List<RouteSurveyTaskDataBO> getAllRouteSurveyTaskDataBO(){
//        return realm.where(RouteSurveyTaskDataBO.class).findAll();
//    }
//    public static List<RouteSurveyTaskDataBO> getAllRouteSurveyTaskDataBOBySturckID(String struckId){
//        return realm.where(RouteSurveyTaskDataBO.class).equalTo("structID",struckId).findAll();
//    }
//    /**
//     * 获取 RouteSurveyTaskBean list
//     */
//    public static List<RouteSurveyTaskBean> getAllRouteSurveyTaskBeans(){
//        return realm.where(RouteSurveyTaskBean.class).findAll();
//    }
//    public static List<RouteSurveyTaskBean> getRouteSurveyTaskBeans(String org_no){
//        return realm.where(RouteSurveyTaskBean.class).equalTo("org_No",org_no).findAll();
//    }
//
//    public static List<RouteSurveyTaskDetailBean> getRouteSurveyTaskDetailBeans(String taskid){
//        return realm.where(RouteSurveyTaskDetailBean.class).equalTo("taskID",taskid).findAll();
//    }
//
//    public static List<RouteSurveyTaskItemBO> getRouteSurveyTaskItemBOs(String taskDetailID){
//        return realm.where(RouteSurveyTaskItemBO.class).equalTo("taskDetailID",taskDetailID).findAll();
//    }

//    public static void insertTrafficInvestBaseInfo(TrafficInvestBaseInfo info){
//        PatrolApp.realm.beginTransaction();
//        PatrolApp.realm.insert(info);
//        PatrolApp.realm.commitTransaction();
//    }

//    public static void insertRouteSurveyTaskDataBOs(List<RouteSurveyTaskDataBO> data){
//        PatrolApp.realm.beginTransaction();
//        PatrolApp.realm.insert(data);
//        PatrolApp.realm.commitTransaction();
//    }
//    public static void updateTrafficInvestBaseInfo(TrafficInvestBaseInfo info){

//    }
//    public static TrafficInvestBaseInfo getTrafficInvestBaseInfo(String id){
//        return realm.where(TrafficInvestBaseInfo.class).equalTo("ID",id).findFirst();
//    }
//    public static List<TrafficInvestBaseInfo> getTrafficInvestBaseInfoAll(){
//        final RealmResults<TrafficInvestBaseInfo> mList = realm.where(TrafficInvestBaseInfo.class).findAll();
//        mList.sort("timeStamp", Sort.DESCENDING);
//        PatrolApp.realm.executeTransaction(new Realm.Transaction() {
//            @Override
//            public void execute(Realm realm) {
//                for (int i=0;i<mList.size();i++){
//                    mList.get(i).index = i+1;
//                }
//
//            }
//        });
//        return mList;
//    }
//    public static List<TrafficInvestBaseInfo> getTrafficInvestBaseInfoByOrgName(String orgName){
//        final RealmResults<TrafficInvestBaseInfo> mList =  realm.where(TrafficInvestBaseInfo.class).equalTo("orgName",orgName).findAll();
//        mList.sort("timeStamp", Sort.DESCENDING);
//        PatrolApp.realm.executeTransaction(new Realm.Transaction() {
//            @Override
//            public void execute(Realm realm) {
//                for (int i=0;i<mList.size();i++){
//                    mList.get(i).index = i+1;
//                }
//
//            }
//        });
//        return mList;
//    }
//    public static void insertTasks(Tasks tasks){
//        delTasks();
//        PatrolApp.realm.beginTransaction();
//        PatrolApp.realm.insert(tasks);
//        PatrolApp.realm.commitTransaction();
//    }
//    public static void delTasks(){
//        realm.executeTransaction(new Realm.Transaction() {
//            @Override
//            public void execute(Realm realm) {
//                realm.delete(Tasks.class);
//                realm.delete(RouteSurveyTaskDetailBean.class);
//                realm.delete(RouteSurveyTaskBean.class);
//                realm.delete(RouteSurveyTaskItemBO.class);
//                realm.delete(RouteSurveyTaskStructBO.class);
//            }
//        });
//
//
//
//    }
//    public static List<RouteSurveyTaskStructBO> getRouteSurveyTaskStructInfo(String taskitemId,String state,TrafficInvestBaseInfo investBaseInfo){
//        int startKm=investBaseInfo.getStartPotKm();
//        int endKm=investBaseInfo.getEndPotKm2();
//
//        if(investBaseInfo.getEndPotMeter2()>0)
//            endKm++;
//        return realm.where(RouteSurveyTaskStructBO.class).equalTo("taskItemID",taskitemId)
//                .between("PotKm",startKm,endKm).findAll();
//
//    }
//    public static RouteSurveyTaskStructBO getRouteSurveyTaskStructInfo(String taskitemId){
//
//        return realm.where(RouteSurveyTaskStructBO.class).equalTo("taskItemID",taskitemId).findFirst();
//
//    }
//    public static RouteSurveyTaskStructBO getRouteSurveyTaskStructInfoById(String id){
//
//        return realm.where(RouteSurveyTaskStructBO.class).equalTo("iD",id).findFirst();
//
//    }
    public static int getLastUpdateStructID(List<String> structIDs){
        return 0;
    }

//    public static List<RouteSurveyTaskDataBO> getTaskDataInfo(String structID,String type){
//        return realm.where(RouteSurveyTaskDataBO.class).equalTo("structID",structID)
//                .equalTo("type",type).findAll();
//    }

    public static void updateRouteSurveyTaskStructInfo(RouteSurveyTaskStructBO info){

    }

    public static void updateRouteSurveyUpdateDataInfo(List<Map<String, String>> infos){

    }
}
